Computes and draws kernel density estimate and then convert them with ggplotly.

p <-    
 ggplot(diamonds, aes(carat)) +
  geom_density()
plotly::ggplotly(p)
p <-    
 ggplot(diamonds, aes(y = carat)) +
  geom_density()
plotly::ggplotly(p)
## Error in data.frame(..., check.names = FALSE): arguments imply differing number of rows: 512, 0
p <-    
 ggplot(diamonds, aes(carat)) +
  geom_density(adjust = 1/5)
plotly::ggplotly(p)
p <-    
 ggplot(diamonds, aes(carat)) +
  geom_density(adjust = 5)
plotly::ggplotly(p)
p <-    
 ggplot(diamonds, aes(depth, colour = cut)) +
  geom_density() +
  xlim(55, 70)
plotly::ggplotly(p)
## Warning: Removed 45 rows containing non-finite values (stat_density).
p <-    
 ggplot(diamonds, aes(depth, fill = cut, colour = cut)) +
  geom_density(alpha = 0.1) +
  xlim(55, 70)
plotly::ggplotly(p)
## Warning: Removed 45 rows containing non-finite values (stat_density).
## Warning: Removed 45 rows containing non-finite values (stat_density).
## Request failed [413]. Retrying in 1.6 seconds...
## Request failed [413]. Retrying in 1 seconds...
## Request failed [413]. Retrying in 5.2 seconds...
## Request failed [413]. Retrying in 5.4 seconds...
## Error: Client error: (413) Request Entity Too Large
##  This file is too big! Your current subscription is limited to 524.288 KB uploads. For more information, please visit: https://plotly.com/get-pricing/.
p <-    
 ggplot(diamonds, aes(carat, fill = cut)) +
  geom_density(position = "stack")
plotly::ggplotly(p)
p <-    
 ggplot(diamonds, aes(carat, after_stat(count), fill = cut)) +
  geom_density(position = "stack")
plotly::ggplotly(p)
p <-    
 ggplot(diamonds, aes(carat, after_stat(count), fill = cut)) +
  geom_density(position = "fill")
plotly::ggplotly(p)